home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 2_7.lha / 2_7 / 2_7.c next >
Text File  |  1993-08-08  |  531b  |  23 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / print out the exponent and mantissa of a double
  6. include <stream.h>
  7.  
  8. include "2_7a.c"        /* EXPAND */
  9.  
  10. oid prdouble(double d)
  11.  
  12.    double_byte db;
  13.    db.d = d;
  14.  
  15.    cout << d << "\n";
  16.    cout << (db.s_m.sign ? "-" : " ");
  17.    cout << hex(db.s_m.exponent, 3) << "    ";
  18.    cout << hex(db.s_m.mantissa, 1);
  19.    for (int i = 2; i < sizeof(double); i++)
  20. cout << hex(db.c[i], 3);
  21.    cout << "\n";
  22.  
  23.